﻿<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <base href="/" />
    <link href="_content/BootstrapBlazor/css/bootstrap.blazor.bundle.min.css" rel="stylesheet">
    <link href="_content/BootstrapBlazor.FontAwesome/css/font-awesome.min.css" rel="stylesheet">
    <link href="css/reset.css" rel="stylesheet">
    <link href="LaserMark.styles.css" rel="stylesheet" />
</head>

<body>
    <div id="app">
        <div class="loading-progress">
        </div>

        <div id="blazor-error-ui">
            <environment include="Staging,Production">
                An error has occurred. This application may no longer respond until reloaded.
            </environment>
            <environment include="Development">
                An unhandled exception has occurred. See browser dev tools for details.
            </environment>
            <a href="" class="reload">Reload</a>
            <a class="dismiss">🗙</a>
        </div>
    </div>
    <script src="_framework/blazor.webview.js"></script>
    <script src="_content/BootstrapBlazor/js/bootstrap.blazor.bundle.min.js"></script>
    <script>
        window.addEventListener('DOMContentLoaded', () => {
            document.body.addEventListener('mousedown', evt => {
                const { target } = evt;
                const appRegion = getComputedStyle(target)['-webkit-app-region'];

                if (appRegion !== 'drag') {
                    return
                } else {
                    chrome.webview.hostObjects.sync.eventForwarder.MouseDownDrag();
                    evt.preventDefault();
                    evt.stopPropagation();
                }
            });
        });
        window.onkeydown = (event) => {
            if (!event || !event.isTrusted || !event.cancelable) {
                return
            }

            const key = event.key
            if (key === 'F5') {
                event.preventDefault()
                event.returnValue = false
            }
            if (event.ctrlKey && e.keyCode == 82) {
                event.preventDefault()
                event.returnValue = false
            }
        }

        const keyCodeMap = {
            // 91: true, // command
            61: true,
            107: true, // 数字键盘 +
            109: true, // 数字键盘 -
            173: true, // 火狐 - 号
            187: true, // +
            189: true, // -
        };
        // 覆盖ctrl||command + ‘+’/‘-’
        document.onkeydown = function (event) {
            const e = event || window.event;
            const ctrlKey = e.ctrlKey || e.metaKey;
            if (ctrlKey && keyCodeMap[e.keyCode]) {
                e.preventDefault();
            } else if (e.detail) { // Firefox
                event.returnValue = false;
            }
        };
        // 覆盖鼠标滑动
        document.body.addEventListener('wheel', (e) => {
            if (e.ctrlKey) {
                if (e.deltaY < 0) {
                    e.preventDefault();
                    return false;
                }
                if (e.deltaY > 0) {
                    e.preventDefault();
                    return false;
                }
            }
        }, { passive: false });
    </script>
</body>

</html>
